<template>
  <div class="home-new">
    <HomePanel title="新鲜好物" sub-title="新鲜出炉 品质靠谱">
      <!-- 具名插槽👇 -->
      <template #right><xtx-more path="/" /></template>
      <!-- 默认插槽👇面板内容 -->
      <transition name="fade" ref="target">
        <ul class="goods-list" v-if="NEWLIST.length">
          <li v-for="item in NEWLIST" :key="item.id">
            <RouterLink to="/">
              <img v-lazy="item.picture" alt="" />
              <p class="name ellipsis">{{ item.name }}</p>
              <p class="price">&yen;{{ item.price }}</p>
            </RouterLink>
          </li>
        </ul>
        <homeSkeleton v-else />
      </transition>
    </HomePanel>
  </div>
</template>
<script setup name:HomeNew>
import homeSkeleton from "@/views/Home/components/home-skeleton";
import HomePanel from "./home-panel.vue";
import { findNew } from "@/api/home.js";
import { lazyLoadingFn } from '@/hooks/index.js'

const { target, data: NEWLIST } = lazyLoadingFn(findNew)
</script>
<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    p:last-child {
      color: #9d9d9d;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
